<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //1.求1-100之间所有数的平均值 
        var sum = 0;
        for (var i = 1; i <= 100; i++) {
            sum += i;
        }
        console.log(sum / 100);
        //2.求 1-100之间所有偶数和奇数的和
        var even = 0;
        var odd = 0;
        for (var i = 1; i <= 100; i++) {
            if (i % 2 == 0) {
                even += i;
            } else {
                odd += i;
            }
        }
        console.log('偶数和为:' + even);
        console.log('奇数和为:' + odd);
        //3.求1-100之间所有能被3整除的数字的和
        var sum = 0;
        for (var i = 1; i <= 100; i++) {
            if (i % 3 == 0) {
                sum += i;
            }

        }
        console.log('1-100之间所有能被3整除的数字的和:' + sum);
    </script>
</head>

<body>

</body>

</html>